<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- bootstrap-css -->
<link rel="stylesheet" href="css/bootstrap.min.css" >
<!-- //bootstrap-css -->
<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<link href="css/style-responsive.css" rel="stylesheet"/>
<!-- font-awesome icons -->
<link rel="stylesheet" href="css/font.css" type="text/css"/>
<link href="css/font-awesome.css" rel="stylesheet">
<style>
	.form-group{
		width: 600px;
	}
.wrapper{
    margin-left: -140px;
   
}
</style>


</head>
<body>
<section id="container">
<!--header start-->

<!--header end-->
<!--sidebar start-->
<aside>

</aside>



<section id="main-content">
	<section class="wrapper">
		<div class="table-agile-info">
  <div class="panel panel-default">
    <div class="panel-heading">
     创建项目
    </div>
   
    <div class="container">
     
     
        <div class="form-group">
        <div class="form-group">
		
		  <label for="text">编号:</label>
		  <input type="text" class="form-control" id="id" placeholder="Enter email">
		
		</div>
		<div class="form-group">
		
		  <label for="text">项目名称:</label>
		  <input type="text" class="form-control" id="t" placeholder="Enter email">
		
		</div>
		<div class="form-group">
			<label for="text">优先级</label>
			<select id="aq">
			<option>缓</option>
			<option>急</option>
			   </select>
			   <label for="text">客户
			   </label>
			   <select id="as">
			   <option value="1">武汉有限公司</option>
			   <option value="2">重庆有限公司</option>
			   </select>
		</div>
		       
		<div class="form-group">
		  <label for="email">计划开始时间:</label>
		  <input type="date" class="form-control" id="k" placeholder="Enter email">
		</div>
		<div class="form-group">
		  <label for="email">计划结束时间:</label>
		  <input type="date" class="form-control" id="j" placeholder="Enter email">
		</div>
		<div class="form-group">
		  <label for="email">奖金:</label>
		  <input type="text" class="form-control" id="r" placeholder="Enter email">
		</div>
		<div class="form-group">
		  <label for="email">开发人数:</label>
		  <input type="number" class="form-control" id="g" placeholder="Enter email">
		</div>
       
        <button type="button" class="btn btn-primary" onClick="projectadd()">创建</button>
     
    </div>
</div>
</section>     
<!--sidebar end-->
<!--main content start-->

		
 <!-- footer -->
		 
  <!-- / footer -->
</section>

<!--main content end-->
</section>

<div class="container">
 
  
 
   
  <!-- 模态框 -->
  <div class="modal fade" id="myModal">
    <div class="modal-dialog modal-lg">
      <div class="modal-content">
   
        <!-- 模态框头部 -->
        <div class="modal-header">
          <h4 class="modal-title">创建模块</h4>
          <button type="button" class="close" data-dismiss="modal">&times;</button>
        </div>

        <!-- 模态框主体 -->
        <div class="modal-body">
          <span id="a"></span>
         <span>模块一</span>
         <div class="input-group mb-3">
    <div class="input-group-prepend">
 <span class="input-group-text">张三</span>
    </div>
    <input type="text" class="form-control" id="ac">
       </div><br>
          <span>模块二</span>
          <div class="input-group mb-3">
    <div class="input-group-prepend">
 <span class="input-group-text">李四</span>
    </div>
    <input type="text" class="form-control" id="b">
       </div><br>
           <span>模块三</span>
           <div class="input-group mb-3">
    <div class="input-group-prepend">
 <span class="input-group-text">王五</span>
    </div>
    <input type="text" class="form-control" id="c">
       </div><br>
            <span>模块四</span>
             <div class="input-group mb-3">
    <div class="input-group-prepend">
 <span class="input-group-text">李二</span>
    </div>
    <input type="text" class="form-control" id="d">
       </div><br>
             <span>模块五</span>
              <div class="input-group mb-3">
    <div class="input-group-prepend">
 <span class="input-group-text">麻子</span>
    </div>
    <input type="text" class="form-control" id="e">
       </div><br>
        </div>
   
        <!-- 模态框底部 -->
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
            <button type="button" class="btn btn-outline-info" onClick="moadd()">提交</button>
        </div>
   
      </div>
    </div>
  </div>
  
</div>

<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">



 function projectadd (){
var title=$("#t").val();
var y=$("#aq").find("option:selected").text();
var m=$("#as").val();
var id=$("#id").val();
var k=$("#k").val();
var j=$("#j").val();
var r=$("#r").val();
var g=$("#g").val();
/* console.log(title);
console.log(y);
console.log(m);
console.log(k);
console.log(j);
console.log(r);
console.log(g); */
 var project={
	 pId:id,	 
	 pName:title,
     pCompany:1,
	 pManager:m,
	 pPrice:r,
     pNumber:g,
	 pDate:j,
	 pGdata:k,
     pPriority:y,
     pState:"未完成",
     pb:id
} 
console.log(project);
$.ajax({
	type:"post",
	url:"pradd",
	data:JSON.stringify(project),
	contentType:"application/json;charset=utf-8",
	success:function(data){
		if(data.status=="success"){
			alert("添加成功");
			$("#myModal").modal("show");
			
		}else{
			alert("添加失败");
		}
	}
})
	
}

function moadd(){
	var id=$("#id").val();
	var d=$("#ac").val();

	var modular={
			 mProject:id,
			 mOne:$("#ac").val(),
			 mTow:$("#b").val(),
			 mtherr:$("#c").val(),
		     mFour:$("#d").val(),
			 mFive:$("#e").val(),
		     mProgressone:"0%",
			 mProgresstow:"0%",
		     mProgressthree:"0%",
		     mProgressfour:"0%",
		     mProgressfive:"0%",
			 mMan:1
			
	}
	console.log(modular)
	$.ajax({
		type:"post",
		url:"moadd",
		data:JSON.stringify(modular),
		contentType:"application/json;charset=utf-8",
		success:function(data){
			if(data.status=="success"){
				alert("添加成功");
				
				
			}else{
				alert("添加失败");
			}
		}
		})
}
</script>
</body>
</html>